package model;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class TPhoto {
	private int id;
	private String photoname;
	private int status;
	
	public TPhoto(){
		
	}
	public TPhoto(ResultSet rs){
		try {
			if(rs != null && rs.next()){
			this.id = rs.getInt("id");
			this.photoname = rs.getString("photoname");
			
			
			this.status = rs.getInt("status");
			
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	public static List<TPhoto> toList(ResultSet rs){
		List<TPhoto> list = new ArrayList<TPhoto>();
		if(rs!=null)
		{
			try {
				while (rs.next()) {
					TPhoto user = new TPhoto();
					user.id = rs.getInt("id");
					user.photoname = rs.getString("photoname");
					
					
					user.status = rs.getInt("status");
					
					list.add(user);
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return list;
		
	}
	
	public TPhoto(int id, String photoname, int status) {
		super();
		this.id = id;
		this.photoname = photoname;
		this.status = status;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getPhotoname() {
		return photoname;
	}

	public void setPhotoname(String photoname) {
		this.photoname = photoname;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}
	
	
	
	
}
